***The following code is used to create Tables 2, 3, and 4 as well as the tables in the supplementary analysis in the article Overcoming Resource Competition Among Co-Ethnics: Elites, Endorsements, and Multiracial Support for Urban Distributive Policies. 
****Load accompanying STATA dateset.  

*Summary statistics for our entire sample
summarize asian black latino gender educ inc AGE partyid7 ideol LA_city if Support != .

*Cooperation Experiment (DV "Support" generated by combining responses over all experimental groups. DV "support" is reverse coded so that increasing values indicate more support)
egen Support = rowtotal(*ingend *noend), missing
recode Support (1 = 4) (2 = 3) (3 = 2) (4 = 1)
label define Support 4"Very Likely" 3"Somewhat Likely" 2"Somewhat Unlikely" 1"Very Unlikely"
label value Support Support
label variable Support "R's support for proposed policy"

*Group 1: In-group Benefit, No Endorsement
gen ingb_noend = 1 if ing_noend != .

*Group 2: In-group Benefit, Endorsement
gen ingb_end = 1 if ing_ingend != .

*Group 3: Out-group Benefit, No Endorsement
gen outb_noend = 1 if latino_noend != .
replace outb_noend = 1 if asian_noend != .
replace outb_noend = 1 if black_noend != .

*Group 4: Out-group Benefit, Endorsement
gen outb_end = 1 if latino_ingend != .
replace outb_end = 1 if black_ingend != .
replace outb_end = 1 if asian_ingend != .

*Generating indicator for if respondent is from LA city.

gen LA_city = 1 if SAMPLE == "Los Angeles"
replace LA_city = 0 if LA_city == .

*To test hypothesis 1:
*IV OutGroupBen = 0 if R assigned to group where in group benefited (no endorsment), 1 if assigned to group where out group benefited (no endorsement)
gen OutGroupBen = 1 if outb_noend == 1
replace OutGroupBen = 0 if ingb_noend == 1

*To test hypothesis 2:
*IV Endors = 1 if R received treatment that included an endorsment, 0 if received treatment that did not include an ednorsement
gen Endors = 1 if outb_end == 1 
replace Endors = 0 if outb_noend == 1 

*Table 3
regress Support OutGroupBen if latino==1
regress Support OutGroupBen if asian==1
regress Support OutGroupBen if black==1
regress Support OutGroupBen

*Table 4
regress Support Endors if latino==1
regress Support Endors if asian==1
regress Support Endors if black==1
regress Support Endors

*Table A1a
reg Support Endors##gender 
reg Support Endors##gender if latino == 1
reg Support Endors##gender if asian == 1
reg Support Endors##gender if black == 1

*Table A1b
reg Support Endors##incomebracket 
reg Support Endors##incomebracket if latino == 1
reg Support Endors##incomebracket if asian == 1
reg Support Endors##incomebracket if black == 1

*Table A1c
reg Support Endors##educ
reg Support Endors##educ if latino == 1
reg Support Endors##educ if asian == 1
reg Support Endors##educ if black == 1

*Table A1d
reg Support Endors##owner
reg Support Endors##owner if latino == 1
reg Support Endors##owner if asian == 1
reg Support Endors##owner if black == 1
